package com.ugtss.busniess.service.impl;


import com.ugtss.busniess.domain.Student;
import com.ugtss.busniess.domain.StudentEmployment;
import com.ugtss.busniess.mapper.StudentEmploymentMapper;
import com.ugtss.busniess.mapper.StudentMapper;
import com.ugtss.busniess.service.StudentEmploymentService;
import com.ugtss.busniess.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentEmploymentServiceImpl implements StudentEmploymentService {

    @Autowired
    private StudentEmploymentMapper studentEmploymentMapper;

    @Override
    public List<StudentEmployment> selectStudentEmploymentList(StudentEmployment studentEmployment) {
        return studentEmploymentMapper.selectStudentList(studentEmployment);
    }

    @Override
    public Boolean saveOrUpdateStudentEmployment(StudentEmployment studentEmployment) {
        if (studentEmployment.getEmploymentId()!=null){
            return studentEmploymentMapper.update(studentEmployment) == 1;
        }else {
            return studentEmploymentMapper.save(studentEmployment) == 1;
        }
    }

    @Override
    public StudentEmployment getStudentEmploymentById(Integer id) {
        return studentEmploymentMapper.getStudentByUserId(id);
    }

    @Override
    public Boolean deleteById(Integer id) {
        return studentEmploymentMapper.deleteById(id) == 1;
    }
}

